/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrl.amto;

/**
 *
 * @author Mr.Sam
 */
import fr.ove.openmath.jome.ctrl.linear.events.LinearParserEvent;
import fr.ove.openmath.jome.ctrl.amto.MapsToNAry;

/**
* The abstract math tree object of a list.
*
* @author © 1999 DIRAT Laurent
* @version 1.0  18/11/1999
*/
public class AList extends MapsToList {
    /**
    * The constructor.
    * @param identifier the identifier of the instance.
    * @param token the identifier of the instance by the mean of the event sent.
    */
    public AList() {
        super("list", LinearParserEvent.OPEN_CURLY, LinearParserEvent.CLOSE_CURLY);
    }
    
    /**
    * "Flushes" the object as a sequence of events for the building of the model
    */
    public void flush() {
        if (getNbChildren() > 0) {
            AbstractMathTreeObject child = getChild(0);
            // Beurk !!!!
            // Si on a une list d'entry, on met une liste verticale.
            // On peut ne tester que sur le premier fils. (sinon objet incorrect, et on affiche 
            // comme un liste normale (i.e. horizontale avec les accolades))
            // Pour une liste verticale, c'est la fonction "vlist".
            if (child.identifier.equals("function") && child.param.equals("entry")) {
                opening = LinearParserEvent.FUNCTION;
                closing = LinearParserEvent.CLOSE_PAREN;
                param = "vlist";
            }
            super.flush();
        }
    }
}